<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>${title}</title>
    <link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap.css"/>
    <link href="${basePath}/static/css/basic.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/login.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/list.css" rel="stylesheet" type="text/css">
	<script  type="text/javascript" src="${basePath}/static/js/jquery.min.js"></script>
	<script  type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${basePath}/static/page/jqPaginator/jqPaginator.js"></script>
	<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
	<link href="${basePath}/static/layer/layer_style.css" rel="stylesheet" type="text/css">
    
</head>
<body>
<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<!--内容部分-->
<div class="list_main lay_out" class="clearfix">
    <div class="list_DH">
        <%@include file="/WEB-INF/templates/common/qualityNav.jsp"%>
    </div>
    <div class="list_NR">
        <div class="loc">
            <h3 style="margin:0;font-size:16px">病案返修</h3>
        </div>
        <div class="list_con_table">
            <div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
                	 <li class="Label_1" >识别码：&nbsp;</li>
               <li class="Label_2">
               	<input class="input_box" type="text"  name="mrId" value='${map.mrId}' />
               </li>
               <li class="Label_1" >患者名：&nbsp;</li>
               <li class="Label_2">
               	<input class="input_box" type="text"  name="name" value='${map.name}' />
               </li>
               <li class="Label_1">身份证号：&nbsp;</li>
               <li class="Label_2" ><input class="input_box" type="text"   name="idCard"  value='${map.idCard}' />          	 
               </li>
                    <li class="Label_1">质控修改日期：&nbsp;</li>
                    <li class="Label_4" style="text-align: left;padding-left:4px;">
                    <input class="input_box" style="width:150px;" type="text"  name='startTime' id='startTime' value='' onFocus="WdatePicker()" /><span>&nbsp;-&nbsp;</span>
                    <input class="input_box" type="text" style="width:150px;"  name='endTime' id='endTime' value='' onFocus="WdatePicker()" /></li>
                    <li class="Label_5">
                        <div class="right" style="text-align:right">
                            <a href="javascript:queryQua(1,20)">查询</a>  
                            <a href="javascript:exportExcel()">导出</a> 
                        </div>
                    </li> 
                </ul>
            </div> 
             <table class="Search_tableList" cellpadding="0" cellspacing="0">
                <tr>
                    <!-- <td class="tdLabel_4">病案号</td> -->
                    <td class="tdLabel_4">识别码</td>
                    <td class="tdLabel_4">姓名</td>
                    <td class="tdLabel_4">修改时间</td>
                    <td class="tdLabel_4">返修前内容</td>
                    <td class="tdLabel_4">返修后内容</td>
                    <td class="tdLabel_4">返修者</td>
                   
                </tr>
                
                <tbody id="tbody">
 
                </tbody>
            </table>
        </div>
         <div class="pageList">
            <ul class="pagination clearfix" id="page_plus"></ul>
            <div class="pagination">
                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
            </div>
        </div> 
    </div>
</div>
<!------页脚部分--------->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>

<!--JS部分-->
<script type="text/javascript">
	function exportExcel(){
		var startTime=$("#startTime").val();
		var endTime=$("#endTime").val(); 
		var name=$("#name").val(); 
		var idCard=$("#idCard").val(); 
		var mrId=$("#mrId").val();
		if(!startTime && !endTime  && !name && !idCard && !mrId ){
			layer.alert("请输入导出条件!", {icon: 0});
			return;
		}
		
		$.ajax({
			type:"post",
			url:"${basePath}/quality/selectMedRepairByKeyWords",
			data:{name:name,idCard:idCard,mrId:mrId,startTime:startTime,endTime:endTime},
			success:function(data){
				if(data.success){
					location.href="${basePath}/quality/exportMedRepairToExcel"
				}else{
					layer.alert(data.msg, {icon: 5});
				}
			}
		})
	}

	function queryQua(pageNo,pageSize){
		var startTime=$("#startTime").val();
		var endTime=$("#endTime").val(); 
		var name=$("#name").val(); 
		var idCard=$("#idCard").val(); 
		var mrId=$("#mrId").val();
		if(!startTime && !endTime  && !name && !idCard && !mrId ){
			layer.alert("请输入查询条件!", {icon: 0});
			return;
		}
		$.ajax({
			type:"post",
			url:"${basePath}/quality/selectMedRepairByKeyWords",
			data:{name:name,idCard:idCard,mrId:mrId,startTime:startTime,endTime:endTime,pageNo:pageNo,pageSize:pageSize},
			success:function(data){
				console.log(data)
				if(data.success){			
					var dataList=data.data.list;
					var dataCount=data.data.count;
					var len=dataList.length;
					if(len>0){
						page(pageNo,dataCount)
						var html="";
						for(var i=0;i<len;i++){
							var repairMsg=dataList[i];
							html+=" <tr>"+
			                   /*    "		<td class='tdLabel_5'>"+repairMsg.onlyId+"</td>"+ */
			                   	  "		<td class='tdLabel_5'>"+repairMsg.mrId+"</td>"+
			                      "		<td class='tdLabel_5'>"+repairMsg.name+"</td>"+
			                      "		<td class='tdLabel_5'>"+repairMsg.createTime+"</td>"+
			                      "		<td class='tdLabel_5'>"+repairMsg.preQualityRepairContent+"</td>"+
			                      "		<td class='tdLabel_5'>"+repairMsg.qualityRepairContent+"</td>"+
			                      "		<td class='tdLabel_5'>"+repairMsg.updateMan+"</td> "+
			                	  "	</tr>"
						}
						$("#tbody").html(html);
					}else{
						layer.alert('查询数据为空!', {icon: 5});
					    $("#tbody").html("");
	                    $("#currentPage").html("0/0");
						$("#totalPage").html("0");
						$("#page_plus").html("");
					}
					
					}else{
						$("#tbody").html("");
						layer.alert(data.msg, {icon: 5});
					}
			}
		})
	
		
	}
	
	 function page(currentPage,totalCounts){
	        var pageSize = 20;
	        var visiblePages = 10;
	        var totalPages = Math.ceil(totalCounts/pageSize);
	        $('#page_plus').jqPaginator({

	            totalCounts: totalCounts,
	            pageSize:pageSize,
	            visiblePages: visiblePages,
	            currentPage: currentPage,

	            first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
	            prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
	            next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
	            last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
	            page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
	            onPageChange: function (num,type) {
	            	
	            	 if(type !='init'){
	                 
	            		 queryQua(num,pageSize);
	                 }
	            	
	                $("#totalPage").html(totalCounts);
	                $("#currentPage").html(num+"/"+totalPages);
	            }
	        });

	    }
</script>

</body>
</html>